<?php
namespace Plugin\Attractions\AttractionManagement\Schema\Attraction_user;

use Plugin\Attractions\AttractionManagement\Model\Attraction_user\AttractionUser;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 用户表
 */
#[Schema(title: 'AttractionUserSchema')]
class AttractionUserSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: '用户ID', type: 'int')]
    public string $id;

    #[Property(property: 'username', title: '用户名', type: 'varchar')]
    public string $username;

    #[Property(property: 'avatar', title: '用户头像', type: 'blob')]
    public string $avatar;

    #[Property(property: 'times', title: '用户登录次数', type: 'int')]
    public string $times;

    #[Property(property: 'open_id', title: '微信OpenID', type: 'varchar')]
    public string $open_id;

    #[Property(property: 'status', title: '用户状态: 1正常, 2禁用', type: 'tinyint')]
    public string $status;

    #[Property(property: 'created_at', title: 'created_at', type: 'datetime')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'datetime')]
    public string $updated_at;

    #[Property(property: 'deleted_at', title: 'deleted_at', type: 'timestamp')]
    public string $deleted_at;




    public function __construct(AttractionUser $model)
    {
       $this->id = $model->id;
       $this->username = $model->username;
       $this->avatar = $model->avatar;
       $this->times = $model->times;
       $this->open_id = $model->open_id;
       $this->status = $model->status;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;
       $this->deleted_at = $model->deleted_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'username' => $this->username ,'avatar' => $this->avatar ,'times' => $this->times ,'open_id' => $this->open_id ,'status' => $this->status ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at ,'deleted_at' => $this->deleted_at];
    }
}